package com.tiancheng.trade.settlement.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
@AllArgsConstructor
public enum ErrorTypeEnum {

    PLATFORM_NO("1", "平台无"),
    PLATFORM_YES("0", "平台有");


    private String code;
    private String desc;

    public static String getDesc(String code) {
        Optional<ErrorTypeEnum> found = Arrays.stream(ErrorTypeEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
